package vlc.ui;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JSlider;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.*;
@SuppressWarnings("serial")
public class HeadInterface extends JPanel {
	private Main p_jframe;
	protected JToggleButton pr_playlist;
	private JPanel top,bottom; 
	public HeadInterface(Main frame ) {
		p_jframe = frame ;
		setLayout(new BorderLayout());



		top=new JPanel();
		top.setLayout(new BorderLayout());
		JPanel tLeft=new JPanel();
		tLeft.add(new JButton((Icon)new ImageIcon("icons/slow.png")));
		tLeft.add(new JToggleButton((Icon)new ImageIcon("icons/play.png")));
		tLeft.add(new JButton((Icon)new ImageIcon("icons/fast.png")));
		top.add(tLeft,BorderLayout.WEST);
		top.add(new JSlider(),BorderLayout.CENTER);




		bottom=new JPanel();
		JPanel bLeft=new JPanel();
		JPanel bRight=new JPanel();
		bottom.setLayout(new BorderLayout());
		bLeft.add(new JButton((Icon)new ImageIcon("icons/prev.png")));
		bLeft.add(new JButton((Icon)new ImageIcon("icons/stop.png")));
		bLeft.add(new JButton((Icon)new ImageIcon("icons/next.png")));
		bLeft.add(new JLabel((Icon)new ImageIcon("icons/volume_down.png")));
		bLeft.add(new JSlider());
		bLeft.add(new JLabel((Icon)new ImageIcon("icons/volume_up.png")));
		bRight.add(new JButton((Icon)new ImageIcon("icons/mixer.jpeg")));
		pr_playlist =new JToggleButton((Icon)new ImageIcon("icons/playlist.png"));
		bRight.add(pr_playlist);
		pr_playlist.addActionListener( new ActionListener(){

			public void actionPerformed(ActionEvent e){
				if (pr_playlist.isSelected())
					p_jframe.showPlaylist();
				else 
					p_jframe.hidePlaylist();
			}
		});
		bottom.add(bLeft,BorderLayout.WEST);
		bottom.add(bRight,BorderLayout.EAST);


		add( top,BorderLayout.NORTH);
		add(bottom,BorderLayout.SOUTH);
	}
	public Dimension fullvisible(){
		return new Dimension(top.getLayout().preferredLayoutSize(this).width,
				top.getLayout().preferredLayoutSize(top).height+bottom.getLayout().preferredLayoutSize(bottom).height);
	}



}
